<template>
  <div
    id="ChooseCraftsman"
    :class="{
      pcStyle: !showMoble,
      smallFontSize: showEdition,
      mediumFontSize: !showEdition
    }">
    <!--<div class="title">-->
    <!--<span @click="onClickLeft" style="position: absolute;left: 5px;display: flex;align-items: center;font-size: 14px;">-->
    <!--&lt;!&ndash; <van-icon name="arrow-left" /> &ndash;&gt;-->
    <!--&lt;!&ndash; 返回 &ndash;&gt;-->
    <!--</span1>-->
    <!--粤政易v1-->
    <!--</div>-->
    <div class="top">
      <img style="width: 80%; margin: 0 auto" src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/ZLJ/SQ/4.png" />
      <p>
        <span :class="showMoble ? '' : 'PADD1'" style="width: 22%; display: inline-block; text-align: center">申请</span>
        <span style="width: 25%; display: inline-block; text-align: center">选图选工匠</span>
        <span style="width: 25%; display: inline-block; text-align: center">签订合同</span>
        <span :class="showMoble ? '' : 'PADD2'" style="width: 21%; display: inline-block; text-align: center">四到场</span>
      </p>
    </div>
    <div style="height: 15px; background: #eee"></div>
    <div id="hamburger-container" style="background: #ffffff; padding-left: 20px; z-index: 100000 !important ; padding: 0 34px; font-size: 17px; color: #646566; border-bottom: 1px solid #d2d2d2">
      <div style="line-height: 22px">附件</div>
      <div style="line-height: 22px; color: #409eff" @click="handkleGoPdf('1')">条件书.pdf</div>
      <div style="line-height: 22px; color: #409eff" @click="handkleGoPdf('2')">一次性告知书.pdf</div>
      <div style="line-height: 22px; color: #409eff" @click="handkleGoPdf('3')">补正告知书.pdf</div>
    </div>
    <div id="hamburger-container1" class="fromList">
      <span style="color: #ff0000">*</span>
      <van-field
        :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }"
        readonly
        clickable
        :value="JFTZ"
        label="建房图纸"
        placeholder="点击选择或上传图纸"
        @click="JFTZClick('建房图纸')" />
    </div>
    <div v-if="tableData" style="background: #f6f6f6; padding: 6px 20px">
      <div class="fromList" style="background: #ffffff">
        <span style="color: #ff0000">*</span>
        <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" v-model="tableData.BUILDAREA" label="占地面积" placeholder="请填写占地面积" />
        <span style="width: 25px; display: inline-block">m²</span>
      </div>
      <div class="fromList" style="background: #ffffff">
        <span style="color: #ff0000">*</span>
        <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" v-model="tableData.HOUSEFLOORAREA" label="建筑面积" placeholder="请填写建筑面积" />
        <span style="width: 25px; display: inline-block">m²</span>
      </div>
      <div class="fromList" id="hamburger-container2" style="background: #ffffff">
        <!-- <span style="color: #ff0000">*</span> -->
        <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" readonly v-model="cengshu" label="建筑层数" placeholder="请填写建筑层数" />
        <span style="width: 25px; display: inline-block">层</span>
        <!-- <van-popup v-model="showPicker" position="bottom">
          <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" />
        </van-popup>-->
      </div>
      <div class="fromList" style="background: #ffffff">
        <!-- <span style="color: #ff0000">*</span> -->
        <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" v-model="tableData.BUILDHEIGHT" label="檐口高度" placeholder="请填写檐口高度" />
        <span style="width: 25px; display: inline-block">m</span>
      </div>
      <div class="fromList" style="background: #ffffff">
        <!-- <span style="color: #ff0000">*</span> -->
        <van-field
          :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }"
          readonly
          clickable
          name="picker"
          :value="tableData.STRUCTURETYPE"
          label="结构类型"
          placeholder="点击选择结构类型"
          @click="showPicker1 = false" />
        <van-popup v-model="showPicker1" position="bottom" get-container="#popup">
          <van-picker value-key="DICNAME" show-toolbar :columns="columns1" @confirm="onConfirm1" @cancel="showPicker1 = false" />
        </van-popup>
      </div>
      <!-- <div class="fromList" style="background: #ffffff">
        <span style="color: #ff0000">*</span>
        <van-field
          :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }"
          readonly
          clickable
          name="picker"
          :value="tableData.JZFG"
          label="建筑风格"
        />
        <van-popup v-model="showPicker2" position="bottom">
          <van-picker show-toolbar :columns="columns2" @confirm="onConfirm2" @cancel="showPicker2 = false" />
        </van-popup>
      </div>-->
      <div class="fromList" style="background: #ffffff">
        <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" v-model="tableData.WALLCOLOR" label="外墙色彩" placeholder="请填写外色彩" />
      </div>
    </div>
    <div id="hamburger-container3" class="fromList" style="background: #ffffff">
      <span style="color: #ff0000">*</span>
      <van-field
        :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }"
        readonly
        clickable
        name="picker"
        :value="IF_DXS | inUseName(columns3)"
        label="是否有地下室"
        placeholder="请选择是否有地下室"
        @click="showPicker3 = true" />
      <van-popup v-model="showPicker3" position="bottom" get-container="#popup">
        <van-picker show-toolbar value-key="DICNAME" :columns="columns3" @confirm="onConfirm3" @cancel="showPicker3 = false" />
      </van-popup>
    </div>
    <!-- <div class="fromList">
      <span style="color: #ff0000">*</span>
      <van-field
        :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }"
        readonly
        clickable
        :value="GJQY"
        label="工匠"
        placeholder="点击选择工匠"
        @click="JFTZClick('工匠')"
      />
    </div> -->
    <van-popup v-model="shoulm1">
      <div class="con_box">
        <h3>{{ text.title }}</h3>
        <p>{{ text.message }}</p>
        <div class="btnv">
          <span @click="handleClose1()" v-if="text.btn.cancelText">
            {{ text.btn.cancelText }}
          </span>
          <span @click="handleOk1()" v-if="text.btn.okText">
            {{ text.btn.okText }}
          </span>
        </div>
      </div>
    </van-popup>
    <div v-show="isshwow" id="hamburger-container4" class="fromList" v-if="tableData.BUILDSTOREY !== '552' || tableData.BUILDSTOREY !== '553' || tableData.BUILDSTOREY !== '554'">
      <span style="color: #ff0000">*</span>
      <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" readonly clickable :value="GJQY" label="建筑企业" placeholder="点击选建筑企业" @click="JFTZClick('企业')" />
    </div>
    <div v-show="isshwowGJ" class="fromList" id="hamburger-container4" v-if="tableData.BUILDSTOREY == '552' || tableData.BUILDSTOREY == '553' || tableData.BUILDSTOREY == '554'">
      <span style="color: #ff0000">*</span>
      <van-field :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" readonly clickable :value="GJQY" label="工匠" placeholder="点击选择工匠" @click="JFTZClick('工匠')" />
    </div>
    <div style="margin: 16px">
      <van-button :class="{ smallFontSize: showEdition, mediumFontSize: !showEdition }" @click="saveData" round block type="info" native-type="submit">下一步</van-button>
    </div>
  </div>
</template>
<script>
import { QuerySignCallback, getRegister1, UploadByUrl, getRegister, SignNumAdd, PhotoNumAdd, sendUserToGsa } from '../../utils/api'
import { v4 as uuidv4 } from 'uuid'
// import Driver from 'driver.js'
import {houseCraftsmanprojectSave1 } from '@/utils/GJSave'
import steps from '../../utils/steps'
export default {
  data() {
    return {
      shoulm1: false,
      text: {
        title: '提示',
        message: '系统检测到您未选择或上传图集，请到乡镇街道部门上传！',
        btn: {
          okText: '确定',
          cancelText: '取消'
        }
      },
      isshwow: true,
      isshwowGJ: true,
      showEdition: true,
      QYMC: {},
      driver: null,
      JFTZ: '',
      GJQY: '',
      IF_DXS: this.$store.state.DXS,
      ZDMJ: '',
      value: '',
      QWSC: '',
      JZMJ: '',
      JZCS: '',
      ZZGD: '',
      baseurl: window.g.BaseURL4,
      columns: ['1层', '2层', '3层', '4层', '5层'],
      columns1: ['结构类型1', '结构类型1', '结构类型1', '结构类型1', '结构类型1'],
      columns2: ['建筑风格1', '建筑风格2', '建筑风格3', '建筑风格4', '建筑风格5'],
      count: 1,
      columns3: [
        {
          DICID: '703',
          DICNAME: '地下室'
        },
        {
          DICID: '704',
          DICNAME: '架空层'
        },
        {
          DICID: '705',
          DICNAME: '无'
        }
      ],
      showPicker: false,
      showPicker1: false,
      showPicker2: false,
      showPicker3: false,
      JGLX: '',
      JZFG: '',
      tableData: {},
      showMoble: false, //初始化移动端相关内容的显示
      Edition: '',
      user_id: '',
      row: '',
      enums: [
        {
          DICID: '552',
          DICNAME: '一'
        },
        {
          DICID: '553',
          DICNAME: '二'
        },
        {
          DICID: '554',
          DICNAME: '三'
        },
        {
          DICID: '555',
          DICNAME: '四'
        },
        {
          DICID: '556',
          DICNAME: '五'
        },
        {
          DICID: '557',
          DICNAME: '六'
        },
        {
          DICID: '558',
          DICNAME: '七'
        },
        {
          DICID: '559',
          DICNAME: '八'
        },
        {
          DICID: '560',
          DICNAME: '九'
        },
        {
          DICID: '561',
          DICNAME: '十'
        }
      ]
    }
  },
  filters: {
    inUseName: function (msg, data) {
      let name = ''
      data.forEach((item) => {
        if (item.DICID == msg) {
          name = item.DICNAME
        }
      })
      return name
    }
  },
  computed: {
    cengshu() {
      var newValues = ''
      this.enums.forEach((item) => {
        if (this.tableData.BUILDSTOREY == item.DICID) {
          newValues = item.DICNAME
        }
      })
      return newValues
    }
  },
  props: {
    SGXKData: null
  },
  created() {
    this.judgmentResolution()
    this.getIpAdress()
  },
  methods: {
    //测试步骤指引
    zhiyin() {
      // 配置说明
      const stepDefinition = {
        // 高亮元素
        element: '#stept1',
        // 高亮显示的元素的背景色
        stageBackground: '#ffffff',
        popover: {
          className: 'popover-class',
          title: '弹窗标题',
          description: '步骤描述内容',
          // 是否显示控制按钮，默认为 true [ ture显示/false隐藏 ]
          showButtons: true,
          doneBtnText: '结束',
          closeBtnText: '关闭',
          nextBtnText: '下一步',
          prevBtnText: '上一步',
          /**弹窗显示的位置
           * left, left-center, left-bottom,
           * top, top-center, top-right,
           * right, right-center, right-bottom,
           * bottom, bottom-center, bottom-right,
           * mid-center
           */
          position: 'left'
        },
        // 从当前步骤移动到下一步时调用
        onNext: () => {},
        // 从当前步骤移动到上一步时调用
        onPrevious: () => {}
      }
      const driver = new Driver()
      // 设置单个元素
      driver.highlight(stepDefinition)

      // 设置分步指南
      // driver.defineSteps([
      //   stepDefinition1,
      //   stepDefinition2,
      //   stepDefinition3
      // ])
    },
    guide() {
      debugger
      this.driver.defineSteps(steps)
      this.driver.start()
    },
    //步骤
    handleApi() {
      const driver = new Driver({
        // 设置提示框的 className, 默认 ''
        className: 'scoped-class',
        // 是否设置动画, 默认 true
        animate: true,
        // 背景不透明度（0表示只有弹出框，没有覆盖）
        opacity: 0.75,
        // 元素与边缘周围的距离
        padding: 10,
        // 点击遮罩层是否关闭, 默认 true
        allowClose: true,
        // 点击遮罩层进行下一步提示
        overlayClickNext: false,
        doneBtnText: '结束',
        closeBtnText: '关闭',
        // 高亮显示的元素的背景色
        stageBackground: '#ffffff',
        nextBtnText: '下一步',
        prevBtnText: '上一步',
        // 是否显示控制按钮，默认为 true [ ture显示/false隐藏 ]
        showButtons: false,
        // 允许通过键盘进行控制（ESC退出关闭，左右箭头键移动）
        keyboardControl: true,
        scrollIntoViewOptions: {},
        // 当元素即将高亮显示时调用
        onHighlightStarted: (Element) => {},
        // 当元素完全高亮显示时调用
        onHighlighted: (Element) => {},
        // 取消选择元素时调用
        onDeselected: (Element) => {},
        // 将要清除覆盖时调用
        onReset: (Element) => {},
        // 移动到下一步骤时调用
        onNext: (Element) => {},
        // 移动到上一步骤时调用
        onPrevious: (Element) => {}
      })
    },
    handleClose1() {
      this.shoulm1 = false
    },
    handleOk1() {
      //直接发送
      this.saveDataByUser()
      //alert(1);
      //this.shoulm1 = true;
      // this.$router.push({
      //   path: '/TreeSelect',
      //   query: { data: this.newItem, isnhzg: 1 },
      // })
    },
    getJGLX: async function () {
      let dataGuid = 'b65d1943-66f4-49b1-b759-cd9f079dc0d3'
      let searchObject = []
      let token = window.localStorage.getItem('token')
      let params2 = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataguid: dataGuid,
          searchObject: searchObject,
          bizGuid: 'd718f2a6-6d0a-42d2-9f03-e396fd056b79',
          token: token
        }
      }
      const res = await QuerySignCallback(params2)
      this.columns1 = eval('(' + res.data.data + ')').Data
      this.columns1.forEach((item, index) => {
        if (item.DICID === this.tableData.STRUCTURETYPE) {
          this.tableData.STRUCTURETYPE = item.DICNAME
        }
      })
    },
    //获取当前预览的ip地址
    getIpAdress: async function () {
      let dataGuid = '74d6dca8-0b5d-47e9-a3bd-c44fdb592732' //正式环境
      // let dataGuid = 'a7890e25-2501-46ed-99b6-ca491c9376ae'
      let searchObject = []
      let token = window.localStorage.getItem('token')
      let params2 = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataguid: dataGuid,
          searchObject: searchObject
        }
      }
      const res = await QuerySignCallback(params2)
      this.row = eval('(' + res.data.data + ')').Data[0]
      console.log(this.row, 'jkjkjk')
    },
    handkleGoPdf(item) {
      var groupGuid = ''
      var dataGuid = '951fb981-aedf-4144-b9ea-1aee47a188ae'
      if (item == '1') {
        groupGuid = '{AB92CB36-C34F-45B5-A272-E0887E959207}'
      } else if (item == '2') {
        groupGuid = '{AE2F0B7A-7AF9-489B-B9F1-ECAEB6E9D343}'
      } else {
        groupGuid = '{26EB6459-0043-4093-AFDC-364B0781FF7C}'
      }
      let baseurl = this.row.F_WAIWANGIP.replace(/#/g, ':')
      let url = baseurl + '/PrintServer/api/PreviewWordRpt?groupGuid=' + groupGuid + '&toRowGuid=' + this.tableData.ROW_GUID + '&dataGuid=' + dataGuid
      let url1 = window.g.BaseURL + '/api/farmerHouse/proxy/dataTransFile/v2?fileUrl=' + encodeURIComponent(url)
      console.log(url1, 'dhfioe')
      ZWJSBridge.openLink({
        url: url1
      })
        .then((res) => {})
        .catch((err) => {
          window.open(url1)
        })
      // this.$router.push({
      //   path: './viewPDF',
      //   query: {
      //     data: url1
      //   }
      // })
    },
    /* 分辨率区分--PC端+移动端1 */
    judgmentResolution() {
      var sUserAgent = navigator.userAgent.toLowerCase()
      var bIsIpad = sUserAgent.match(/ipad/i) == 'ipad'
      var bIsIphoneOs = sUserAgent.match(/iphone os/i) == 'iphone os'
      var bIsMidp = sUserAgent.match(/midp/i) == 'midp'
      var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == 'rv:1.2.3.4'
      var bIsUc = sUserAgent.match(/ucweb/i) == 'ucweb'
      var bIsAndroid = sUserAgent.match(/android/i) == 'android'
      var bIsCE = sUserAgent.match(/windows ce/i) == 'windows ce'
      var bIsWM = sUserAgent.match(/windows mobile/i) == 'windows mobile'
      if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
        this.showMoble = true
      } else {
        this.showMoble = false
      }
    },
    JFTZClick(data) {
      console.log(this.tableData)
      switch (data) {
        case '建房图纸':
          window.localStorage.setItem('routerData', '')
          debugger
          this.$router.push({
            path: '/BuildingServer',
            query: {
              id: 'ChooseCraftsman',
              data: this.tableData,
              data10: '1'
            }
          })
          break
        case '工匠':
          window.localStorage.setItem('routerData', '')
          window.sessionStorage.setItem('ChangeGJ', false)
          this.$router.push({
            path: '/craftsmanServices',
            query: {
              id: 'ChooseCraftsman',
              data: JSON.stringify(this.tableData)
            }
          })
          break
        case '企业':
          window.localStorage.setItem('routerData', '')
          window.sessionStorage.setItem('ChangeGJ', false)
          this.$router.push({
            path: '/appraisalCompany',
            query: {
              id: 'appraisalCompany',
              data: JSON.stringify(this.tableData)
            }
          })
          break
      }
    },
    onConfirm1(value) {
      this.tableData.STRUCTURETYPE = value.DICNAME
      this.showPicker1 = false
    },
    onConfirm2(value) {
      this.tableData.JZFG = value
      this.showPicker2 = false
    },
    onConfirm3(value) {
      debugger
      this.IF_DXS = value.DICID
      this.$store.commit('getIF_DXS', value.DICID)
      if (value.DICID == '703') {
        this.isshwowGJ = false
      } else {
        if (!this.$route.query.COMAPNY_NAME) {
          this.isshwowGJ = true
        }
      }
      this.showPicker3 = false
    },
    onClickLeft() {},
    handle1: async function (data) {
      let parms = {
        wfGuid: '{9FF1C524-B55F-4A45-83B3-6EA46CF32092}',
        entityRowGuid: data,
        token: window.localStorage.getItem('token')
      }
      let params1 = {
        accessCode: '2c824ce489ff4cffaa0d77082e6fb648',

        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: parms
      }
      const res = await QuerySignCallback(params1)
      //   this.sendData.push()
      //   let obj = {}
      //   res.data.SendData.forEach(item => {
      //     if (item.PTNID != -1&&item.) {
      //       obj = item
      //     }
      //   })
      this.$toast.success('保存成功')
      //打开用户选择界面
      if (JSON.parse(window.sessionStorage.getItem('fileData'))?.S) {
        //切换
        this.$emit('handleactive', 1)
        window.sessionStorage.setItem('active', 1)
      } else {
        
        setTimeout(() => {
          this.$router.push({
            path: '/TreeSelect',
            query: {
              data: this.tableData,
              isxgj: 1
            }
          })
        }, 1000)
      }
      //   this.handle2(data, res.data.SendData[1])
    },
    // //注册工匠接口
    getRegister1: async function () {
      //   //注册接口
      let Base64 = require('js-base64').Base64
      let pae = {
        st_name: this.$store.state.GJQY.artisanName, //用户
        loginName: Base64.decode(this.$store.state.GJQY.phone),
        citycode: this.$store.state.GJQY.citycode, //村citycode
        zjcitycode: '', //镇街citycode
        sfzh: Base64.decode(this.$store.state.GJQY.idCard), //身份证号
        mobile: Base64.decode(this.$store.state.GJQY.phone), //手机号
        roleNode: 8 //农户7  工匠8
      }
      let p = {
        accessCode: '6e9625b5c366654eb306aa372145b759',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: pae
      }
      const data1 = await QuerySignCallback(p)
      this.user_id = JSON.parse(data1.data.data).data
      //将工匠推送到gsa
      // if(data1.data.code == 200){
      let pae3 = {
        username: this.$store.state.GJQY.artisanName, //用户
        loginName: Base64.decode(this.$store.state.GJQY.phone),
        cityCode: this.$store.state.GJQY.citycode.length == 6 ? this.$store.state.GJQY.citycode + '000000' : this.$store.state.GJQY.citycode, //村citycode
        idNum: Base64.decode(this.$store.state.GJQY.idCard), //身份证号
        phone: Base64.decode(this.$store.state.GJQY.phone),
        roleType: '8',
        userType: '3',
        buildType: 0
      }
      const res = await getRegister1(pae3)
      if (res.data.code == 200) {
        // this.$toast.success = "注册成功"
      } else {
        this.$toast.fail('注册失败')
      }
    },
    //点击下一步调用存储过程
    getUpadatefun: async function () {
      let paerssend = {
        procName: 'UP_AtlasState',
        dtParams: JSON.stringify([{ I_ROW_GUID: window.localStorage.getItem('GJRowGUID') }]),
        token: window.localStorage.getItem('token')
      }
      let paramsendMEssage = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: paerssend
      }
      const reqwmsg = await QuerySignCallback(paramsendMEssage)
      // const JSONSend = JSON.parse(reqwmsg.data.data).Data;
    },
    //判断当前环节是不是退回的件（已经保存过的件 保存过得调用修改的接口）
    saveData: async function () {
      debugger
      //逻辑重新梳理
      //判断工匠和企业如果没有选择，给与提示
      //判断图纸没有选择 给提示
      //图集给与提示
      //新增施工备案相关内容
      //   this.SGXKData 当这个数据有值的时候  不发送
      if (JSON.parse(window.sessionStorage.getItem('fileData'))?.S) {
        if (!this.JFTZ) {
          this.$toast.fail('请选择图集!')
          return
        } else {
          if (!this.$store.state.GJQY && !(this.QYMC && this.QYMC.qymc)) {
            this.$toast.fail('请选择工匠或者建筑企业!')
          } else if (!this.$store.state.JFTZ && window.localStorage.getItem('ISTUJI') != 'true') {
            this.shoulm1 = true
          } else if (this.SGXKData) {
            this.saveDataByUser()
          }
        }
      } else {
        if (!this.JFTZ) {
          this.$confirm({
            title: '温馨提示',
            message: '系统检测到您未选择通用图集，也未上传自传图集，为不影响您的建房审批进度请在提交后到所在乡镇提交自传图集，是否继续提交？',
            btn: {
              okText: '确定',
              cancelText: '取消'
            }
          })
            .then(async () => {
              if (!this.$store.state.GJQY && !(this.QYMC && this.QYMC.qymc)) {
                this.$toast.fail('请选择工匠或者建筑企业!')
              } else if (!this.$store.state.JFTZ && window.localStorage.getItem('ISTUJI') != 'true') {
                this.shoulm1 = true
              } else if (this.SGXKData) {
                this.saveDataByUser()
              } else {
                // alert("2");
                //先判断是否配置三方经纪人
                var citycodes = window.localStorage.getItem('SSZZ_CITYNAME') ? window.localStorage.getItem('SSZZ_CITYNAME') : window.localStorage.getItem('TOWN_CITYNAME')
                var paerssend = {
                  procName: 'up_townaudit',
                  dtParams: JSON.stringify([{ I_USERID: citycodes, I_TYPE: 2 }]),
                  token: window.localStorage.getItem('token')
                }
                var paramsendMEssage = {
                  accessCode: '69db6bece3a7480592e2ec753d1e335e',
                  cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
                  params: paerssend
                }
                const reqwmsg = await QuerySignCallback(paramsendMEssage)
                if (JSON.parse(reqwmsg.data.data).Data.length > 0) {
                  paerssend.dtParams = JSON.stringify([{ I_USERID: citycodes, I_TYPE: 3 }])
                  const reqwmsg1 = await QuerySignCallback(paramsendMEssage)
                  if (JSON.parse(reqwmsg1.data.data).Data.length > 0) {
                    paerssend.dtParams = JSON.stringify([{ I_USERID: citycodes, I_TYPE: 4 }])
                    const reqwmsg2 = await QuerySignCallback(paramsendMEssage)
                    if (JSON.parse(reqwmsg2.data.data).Data.length > 0) {
                      this.saveDataByUser()
                    } else {
                      this.$toast.fail('请联系镇街管理员核查 <镇街农房审核（经办人）> 是否已配置好案卷接受人员！')
                    }
                  } else {
                    this.$toast.fail('请联系镇街管理员核查 <镇街规划审核（经办人）> 是否已配置好案卷接受人员！')
                  }
                } else {
                  this.$toast.fail('请联系镇街管理员核查 <镇街资格审核（经办人）> 是否已配置好案卷接受人员！')
                }
              }
            })
            .catch(() => {
              console.log('no')
            })
          return
        } else {
          if (!this.$store.state.GJQY && !(this.QYMC && this.QYMC.qymc)) {
            this.$toast.fail('请选择工匠或者建筑企业!')
          } else if (!this.$store.state.JFTZ && window.localStorage.getItem('ISTUJI') != 'true') {
            this.shoulm1 = true
          } else if (this.SGXKData) {
            this.saveDataByUser()
          } else {
            // alert("2");
            //先判断是否配置三方经纪人
            var citycodes = window.localStorage.getItem('SSZZ_CITYNAME') ? window.localStorage.getItem('SSZZ_CITYNAME') : window.localStorage.getItem('TOWN_CITYNAME')
            var paerssend = {
              procName: 'up_townaudit',
              dtParams: JSON.stringify([{ I_USERID: citycodes, I_TYPE: 2 }]),
              token: window.localStorage.getItem('token')
            }
            var paramsendMEssage = {
              accessCode: '69db6bece3a7480592e2ec753d1e335e',
              cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
              params: paerssend
            }
            const reqwmsg = await QuerySignCallback(paramsendMEssage)
            if (JSON.parse(reqwmsg.data.data).Data.length > 0) {
              paerssend.dtParams = JSON.stringify([{ I_USERID: citycodes, I_TYPE: 3 }])
              const reqwmsg1 = await QuerySignCallback(paramsendMEssage)
              if (JSON.parse(reqwmsg1.data.data).Data.length > 0) {
                paerssend.dtParams = JSON.stringify([{ I_USERID: citycodes, I_TYPE: 4 }])
                const reqwmsg2 = await QuerySignCallback(paramsendMEssage)
                if (JSON.parse(reqwmsg2.data.data).Data.length > 0) {
                  this.saveDataByUser()
                } else {
                  this.$toast.fail('请联系镇街管理员核查 <镇街农房审核（经办人）> 是否已配置好案卷接受人员！')
                }
              } else {
                this.$toast.fail('请联系镇街管理员核查 <镇街规划审核（经办人）> 是否已配置好案卷接受人员！')
              }
            } else {
              this.$toast.fail('请联系镇街管理员核查 <镇街资格审核（经办人）> 是否已配置好案卷接受人员！')
            }
          }
        }
      }
    },
    //报存
    saveDataByUser: async function () {
      let Base64 = require('js-base64').Base64
      let paerssend = {
        procName: 'up_query',
        dtParams: JSON.stringify([
          {
            I_USERID: "'" + window.localStorage.getItem('GJRowGUID') + "'",
            I_TYPE: 4
          }
        ]),
        token: window.localStorage.getItem('token')
      }
      let paramsendMEssage = {
        accessCode: '69db6bece3a7480592e2ec753d1e335e',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: paerssend
      }
      const reqwmsg = await QuerySignCallback(paramsendMEssage)
      paerssend.dtParams = JSON.stringify([
        {
          //   I_USERID: "'" + window.localStorage.getItem('GJRowGUID') + "'",
          I_USERID: window.localStorage.getItem('GJRowGUID'),
          I_TYPE: 22
        }
      ])
      try {
        const reqwmsg1 = await QuerySignCallback(paramsendMEssage)
      } catch (err) {
        console.log(err)
      }
      const JSONSend = JSON.parse(reqwmsg.data.data).Data[0]
      var newObj1 = JSON.parse(window.sessionStorage.getItem('fileData'))
      this.count = JSONSend.SEARCH
      // if (
      //   (this.$store.state.GJQY && this.$store.state.JFTZ) ||
      //   (this.$store.state.GJQY && window.localStorage.getItem('ISTUJI') == 'true') ||
      //   (this.QYMC && this.$store.state.JFTZ) ||
      //   (this.QYMC && window.localStorage.getItem('ISTUJI') == 'true')
      // ) {
      // if(!this.$store.state.JFTZ.id){
      //   this.$toast.fail('请重新选择工匠！')
      //   return false
      // }
      var addGj = window.sessionStorage.getItem('addGJ')
      if (this.QYMC) {
        var data = [
          {
            XM: this.QYMC.lxr,
            photo: '',
            ZSBH: this.QYMC.zzzsbh,
            TELPHONE: '',
            GJXJ: this.QYMC.fwlx,
            RZSJ: this.QYMC.QYCLSJ,
            ZYXX: '',
            SJSXM: this.$store.state.JFTZ?.technicalUnit?.qymc,
            SJDWFZW: this.$store.state.JFTZ?.technicalUnit?.lxr,
            SCGZ: '',
            //公司名称
            GSMC: this.QYMC?.qymc,
            //统一税号
            TYSH: this.QYMC.zzjgdm,
            //   GJID: this.$store.state.GJQY.artisanName == "朱成明" ? 533 : 72,
            GJID: this.QYMC.id,
            TYPE: 2,
            JZQYZZZSBH: '',
            LXR: '',
            LXDH: '',
            GSDZ: '',
            YYZZZP: '',
            OPTYPE: '60',
            tjlx: this.$store.state.tjlx,
            tjmc: this.$store.state.JFTZ.atlasName,
            tjbh: this.$store.state.JFTZ.id,
            sjsphone: '',
            jzfg: this.$store.state.JFTZ.atlasStyle,
            jzzsc: '',
            djjc: '',
            GJSFZH: this.QYMC.zzjgdm,
            structuretype: '',
            xgt: '',
            IF_DSFSJTZ: '',
            TO_ROW_GUID: this.tableData.ROW_GUID
          }
        ]
        if (newObj1?.S) {
          newObj1.OPTYPE = 60
          newObj1.SQFS = '36'
        }
      } else {
        var data = [
          {
            XM: this.$store.state.GJQY.artisanName,
            photo: '',
            ZSBH: this.$store.state.GJQY.bookNumber,
            TELPHONE: addGj == 1 ? this.$store.state.GJQY.phone : Base64.decode(this.$store.state.GJQY.phone),
            GJXJ: this.$store.state.GJQY.artisanGrade,
            RZSJ: this.$store.state.GJQY.setTime,
            ZYXX: this.$store.state.GJQY.certificateType,
            SCGZ: this.$store.state.GJQY.workerType,
            //公司名称
            GSMC: '',
            SJSXM: this.$store.state.JFTZ?.technicalUnit?.qymc,
            SJDWFZW: this.$store.state.JFTZ?.technicalUnit?.lxr,
            //统一税号
            TYSH: '',
            //   GJID: this.$store.state.GJQY.artisanName == "朱成明" ? 533 : 72,
            GJID: this.user_id,
            TYPE: 2,
            JZQYZZZSBH: '',
            LXR: '',
            LXDH: '',
            GSDZ: '',
            YYZZZP: '',
            GJSFZH: addGj == 1 ? this.$store.state.GJQY.idCard : Base64.decode(this.$store.state.GJQY.idCard),
            OPTYPE: '59',
            tjlx: this.$store.state.tjlx,
            TJMC: this.$store.state.JFTZ.atlasName,
            TJBH: this.$store.state.JFTZ.id,
            sjsphone: '',
            ZFG: this.$store.state.JFTZ.atlasStyle,
            jzzsc: '',
            djjc: '',
            structuretype: '',
            xgt: '',
            IF_DSFSJTZ: '',
            TO_ROW_GUID: this.tableData.ROW_GUID,
            PKID: this.tableData.XZGJ_PKID
          }
        ]
        if (newObj1?.S) {
          newObj1.OPTYPE = 59
          newObj1.SQFS = 35
        }
      }
      if (window.localStorage.getItem('XTXGJGJID') && window.localStorage.getItem('XTXGJGJID') != 'null') {
        data[0].PKID = this.tableData.XZGJ_PKID
      }
      if (newObj1?.S) {
        window.sessionStorage.setItem('fileData', JSON.stringify(newObj1))
      }
      let uuid1 = uuidv4()
      if (this.$store && this.$store.state && this.$store.state.JFTZ && this.$store.state.JFTZ.atlasStyle && this.$store.state.JFTZ.atlasStyle == '通用图集') {
        data[0].TJLX = 157
      }
      if (this.$store && this.$store.state && this.$store.state.JFTZ && this.$store.state.JFTZ.atlasStyle && this.$store.state.JFTZ.atlasStyle == '第三方图集') {
        data[0].TJLX = 158
      }
      debugger
      data.row_guid = uuid1
      let params = {
        dataGuid: '4a9869f7-eb64-4a88-9d67-1e43455d3220',
        strParams: JSON.stringify(data),
        token: window.localStorage.getItem('token')
      }
      let params1 = {
        accessCode: '0fb3f6123d1b4fe6851c99532c463f6f',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: params
      }
      //先判断是新增还是修改
      if (this.count > 0 || (window.localStorage.getItem('XTXGJGJID') && window.localStorage.getItem('XTXGJGJID') != 'null')) {
        params1.accessCode = '77ad6c1591e54d4fbc45ecc90374a2a2'
      }
      const res = await QuerySignCallback(params1)

      if (!this.QYMC) {
        if (eval('(' + res.data.data + ')').Success == true) {
          //更新工匠id
          var formData2 = [
            {
              PKID: this.tableData.PKID,
              row_guid: this.tableData.ROW_GUID,
              GJID: this.user_id,
              IF_DXS: this.IF_DXS,
              GJSFZH: addGj == 1 ? this.$store.state.GJQY.idCard : Base64.decode(this.$store.state.GJQY.idCard),
              NHID: window.localStorage.getItem('userId')
            }
          ]
          let parms = {
            dataGuid: '01103ebf-a884-4282-b996-78dd64196946',
            strParams: JSON.stringify(formData2),
            token: window.localStorage.getItem('token')
          }
          let params1 = {
            accessCode: '77ad6c1591e54d4fbc45ecc90374a2a2',

            cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
            params: parms
          }
          const res2 = await QuerySignCallback(params1)
          this.$toast.success('成功！')
          this.handle1(this.tableData.ROW_GUID)
          let canshu = {
            accessCode: '0fb3f6123d1b4fe6851c99532c463f6f',
            appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
            id: this.$store.state.GJQY.id
          }
          const res1 = await SignNumAdd(canshu)
        } else {
          this.$toast.fail('保存失败')
          return
        }
      } else {
        this.handle1(this.tableData.ROW_GUID)
      }
      //新增图集选择接口
      let parmes1 = {
        accessCode: '3c29655f3f2f4746b9b51bb3ec80400d',
        appKey: '6738c6db-69e8-11ec-a673-6805cab640a0',
        id: this.$store.state.JFTZ.id,
        type: 1 //   type=1 签约量加1  type=2 签约量-1
      }
      const res2 = await PhotoNumAdd(parmes1)
      if (window.localStorage.getItem('ISTUJI') == 'true') {
        this.getUpadatefun()
      }
      //}
      // else {

      //   // this.$notify({ type: "danger", message: "请选择工匠或者图集!" });
      // }
    },
    //获取踏勘信息数据
    GetTKXXDAta: async function () {
      let dataGuid = 'a0e224e8-36be-4591-b770-30cabda3514a'
      let searchObject = JSON.stringify([{ field: 'to_row_guid', value: this.tableData.ROW_GUID, operator: '=' }])
      let parms = {
        dataGuid: dataGuid,
        searchObject: searchObject,
        token: window.localStorage.getItem('token')
      }
      let params1 = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: parms
      }
      const res = await QuerySignCallback(params1)
      let GetTK = JSON.parse(res.data.data)
      if (GetTK.Data && GetTK.Data.length > 0) {
        this.tableData.BUILDAREA = GetTK.Data[0].HOUSEFLOORAREA
        this.tableData.HOUSEFLOORAREA = GetTK.Data[0].BUILDAREA
        this.tableData.BUILDSTOREY = GetTK.Data[0].BUILDSTOREY
        this.tableData.BUILDHEIGHT = GetTK.Data[0].BUILDHEIGHT
        this.tableData.WALLCOLOR = GetTK.Data[0].EXTERIORCOLOR
        this.tableData.STRUCTURETYPE = GetTK.Data[0].STRUCTURETYPE
        this.columns1.forEach((item, index) => {
          if (item.DICID === this.tableData.STRUCTURETYPE) {
            this.tableData.STRUCTURETYPE = item.DICNAME
          }
        })
      }
    }
  },
  activated() {},
  mounted() {
    this.driver = new Driver()
    this.getJGLX()
    this.showEdition = this.$store.state.Edition
    if (this.$store.state.JFTZ && window.localStorage.getItem('ISTUJI') == 'false') {
      debugger
      this.JFTZ = this.$store.state.JFTZ.atlasName
    } else if (window.localStorage.getItem('ISTUJI') == 'true') {
      this.JFTZ = '暂无'
    }
    if (this.$route.query.COMAPNY_NAME) {
      debugger
      this.QYMC = JSON.parse(this.$route.query.COMAPNY_NAME)
      this.GJQY = this.QYMC.qymc
      this.isshwowGJ = false
    }
    if (this.$store.state.GJQY) {
      console.log(this.$store.state.GJQY)
      this.QYMC = ''
      this.GJQY = this.$store.state.GJQY.artisanName
      // this.getRegister1()
      this.isshwow = false
    }
    //获取踏勘信息数据
    this.JFTZClick()
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        title: '粤政易'
      })
        .then((res) => {})
        .catch((err) => {})
      if (this.$store.state.XTXGJData) {
        this.tableData = this.$store.state.XTXGJData
        setTimeout(() => {
          this.GetTKXXDAta()
        }, 500)
      }
    }
    if (this.SGXKData) {
      this.tableData = this.SGXKData
    }
    console.log(this.IF_DXS, 'this.IF_DXS')
    // this.zhiyin()
    // this.guide()
  }
}
</script>
<style lang="scss">
.pcStyle {
  width: 100%;
  height: 100vh;
  overflow: auto !important;
}

#ChooseCraftsman {
  height: 92vh;
  overflow: auto !important;

  .PADD1 {
    padding-right: 66px;
  }

  .PADD2 {
    padding-left: 56px;
  }

  .title {
    width: 100%;
    height: 50px;
    background: #007aff;
    line-height: 50px;
    text-align: center;
    color: #ffffff;
    font-size: 20px;
    position: relative;
  }

  .top {
    height: 60px;
    background: #ffffff;
    margin-bottom: 20px;
    padding-top: 25px;
    text-align: center;

    .origin {
      width: 22px;
      height: 22px;
      background: #007aff;
      border-radius: 50%;
      display: inline-block;
    }

    .line {
      width: 20vw;
      /*height: 1px;*/
      border: 1px dashed #007aff;
      display: inline-block;
    }
  }

  .fromList {
    display: flex;
    border-radius: 4px;
    justify-content: center;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #d2d2d2;
  }

  .van-popup {
    border-radius: 10px;

    .con_box {
      width: 270px;
      line-height: 1;
      text-align: center;
      color: #4d5c82;
      padding: 15px;
      box-sizing: border-box;

      > h3 {
        font-size: 20px;
        margin-top: 10px;
        margin-bottom: 20px;
      }

      > p {
        font-size: 17px;
        margin-bottom: 30px;
      }

      .btnv {
        display: flex;
        justify-content: space-between;

        > span {
          display: block;
          width: 114px;
          background-color: #e0e5f5;
          text-align: center;
          line-height: 44px;
          font-size: 17px;
        }

        > span:last-of-type {
          background-color: #1288fe;
          color: #ffffff;
        }
      }
    }
  }
}
</style>

<style lang="scss">
#ChooseCraftsman .van-cell {
  padding: 6px 16px !important;

  #hamburger-container {
    position: fixed !important;
  }
}

div#driver-highlighted-element-stage,
div#driver-page-overlay {
  background: transparent !important;
  outline: 5000px solid rgba(0, 0, 0, 0.75);
  width: 0 !important;
  height: 0 !important;
  left: 0px !important;
}

#driver-popover-item {
  left: 0px !important;
  z-index: 99999999999999 !important;
}
</style>
